from flask_restful import fields  # type: ignore

from libs.helper import TimestampField
term_fields = {
    "id": fields.String,
    "cmd_id": fields.String,
    "term": fields.String,
    "hit_count": fields.Integer,
    "status":  fields.String,
    "status_zh": fields.String(attribute="status_zh_str"),
}
rob_func_fields = {
    "id": fields.String,
    "tenant_id": fields.String,
    "name": fields.String,
    "descrip": fields.String,
    "fun_type": fields.Integer,
    "fun_type_code": fields.String(attribute="type_code"),
    "fun_type_zh_str": fields.String(attribute="type_zh_str"),
    "interaction_mode": fields.String,
    "need_reconize": fields.Boolean,
    "terms":fields.List(fields.Nested(term_fields)),
    "created_at": TimestampField,
    "updated_at": TimestampField,
    "created_by": fields.String,
    "updated_by": fields.String
}

rob_func_pagenation_fields = {
    "total": fields.Integer,
    "hasMore": fields.Boolean,
    "data": fields.List(fields.Nested(rob_func_fields)),
    "error": fields.String()
}

term_pagenation_fields = {
    "total": fields.Integer,
    "hasMore": fields.Boolean,
    "data": fields.List(fields.Nested(term_fields)),
    "error": fields.String()
}